package com.atguigu.algorithm;

import java.util.List;

public class hanota {
    public void hanoi(List<Integer> A, List<Integer> B,List<Integer> C){
        int i=A.size();
        func(i,A,B,C);
    }
    public void func(int i,List<Integer> from, List<Integer> other, List<Integer> to){
        if(i==1){
            to.add(from.remove(from.size()-1));
        }else{
            func(i-1,from,to,other);
            to.add(from.remove(from.size()-1));
            func(i-1,other,from,to);
        }
    }

}
